package com.kaifamiao.date1110;

import java.util.Objects;

public class Monkey {
	
	private String name ;
	private char gender ;
	private int age ;
	
	public Monkey(String name, char gender, int age) {
		super();
		this.name = name;
		this.gender = gender;
		this.age = age;
	}
	
	@Override
	public int hashCode() {
		/*
		int result = 1 ;
		
		int h = name == null ? 0 : name.hashCode();
		result = 31 * result + h ;
		
		result = 31 * result + age ;
		
		result = 31 * result + gender ;
        
		return result ;
		*/
		return Objects.hash( name , gender , age );
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Monkey other = (Monkey) obj;
		return age == other.age && gender == other.gender && Objects.equals(name, other.name);
	}

	@Override
	public String toString() {
		return "Monkey [name=" + name + ", gender=" + gender + ", age=" + age + "]";
	}

}
